package com.sky.controller.admin;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController("AdminShopController")
@RequestMapping("admin/shop")
@Api(tags = "店铺营业接口")
public class ShopController {

    @Autowired
    private RedisTemplate redisTemplate;

    private final static String KEY="SHOP_STATUS";


@ApiOperation("设置店铺营业状态")
@PutMapping("/{status}")
    public Result SetShopStatus(@PathVariable Integer status){
    redisTemplate.opsForValue().set(KEY,status);
        return Result.success();
    }


@ApiOperation("获取店铺营业状态")
@GetMapping("/status")

public Result<Integer> GetShopStatus(){
    Integer sta=(Integer) redisTemplate.opsForValue().get(KEY);
    return Result.success(sta);
}

}
